class Solution {
public:
  int hammingDistance(int x, int y) {

    int res = x ^ y;
    int ans;

    for(ans = 0; res; ++ans){
      res &= (res - 1);
    }

    return ans;

  }
};
